package game.entity.action;

import edu.monash.fit2099.engine.*;
import game.entity.behavior.PregnancyBehaviour;
import game.util.LocationUtil;

import java.util.Random;

/**
 * Special Action for attacking other Actors.
 */
public class SexAction extends Action {

	/**
	 * The Actor that is to be attacked
	 */
	protected Actor target;
	/**
	 * Random number generator
	 */
	protected Random rand = new Random();

	/**
	 * Constructor.
	 *
	 * @param target the Actor to attack
	 */
	public SexAction(Actor target) {
		this.target = target;
	}

	@Override
	public String execute(Actor actor, GameMap map) {
		Actor female = null;
		if(actor.getSex().equals("female")){
			female = actor;
		}
		if(target.getSex().equals("female")){
			female = target;
		}
		female.setBehaviour(new PregnancyBehaviour(female));

		Location location = map.locationOf(female);
		String locationPrettyString = LocationUtil.getLocationPrettyString(location);
		if(actor.getSex().equals("female")){
			return locationPrettyString + female +" is pregnancy!";
		}else{
			return "";
		}

	}

	@Override
	public String menuDescription(Actor actor) {
		return actor + " attacks " + target;
	}


}
